package com.base.thread;

public class TestSynchronizedLock {
    private Integer count = 10;
    private TestSynchronizedLock lock = new TestSynchronizedLock();

    /**
     * synchronized 同步代码块要出现在方法内部
     * 需要显示指定锁
     *
     * @author: May
     * @date 2021/3/5
     */
    public void setLock() {
        synchronized (lock) {
            count--;
            System.out.println("count = " + count);
        }
    }

    public static void main(String[] args) {

    }
}
